import { Tag } from 'ant-design-vue';
import { h } from 'vue';

export enum Status {
  Enabled = 1, //启用
  Disabled = 2, //禁用
}

export enum Is {
  Yes = 1,
  No = 2,
}

export enum Sex {
  Male = 1,
  Female = 2,
}

export enum MenuType {
  Menu = 1,
  Action = 2,
}

export enum ServerType {
  typeP2p = 1,
  typeHost = 2,
}

export const IsOptions = [
  { label: '是', value: Status.Enabled },
  { label: '否', value: Status.Disabled },
];

export const StatusOptions = [
  { label: '启用', value: Status.Enabled },
  { label: '停用', value: Status.Disabled },
];

export const SexOptions = [
  { label: '男', value: Sex.Male },
  { label: '女', value: Sex.Female },
];

export const StatusTag = (status: number) => {
  const enable = status == Status.Enabled;
  const color = enable ? 'green' : 'red';
  const text = enable ? '启用' : '停用';
  return h(Tag, { color: color }, () => text);
};
